unit UnitMsg;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Buttons, jpeg, ExtCtrls, StdCtrls;

type
  TFexcept = class(TForm)
    Image1: TImage;
    sbclose: TSpeedButton;
    errorlx: TEdit;
    errorobject: TEdit;
    errorinfo: TEdit;
    procedure sbcloseClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormShow(Sender: TObject);
  private
   function GetExceptionClass: String;
    procedure SetExceptionClass(const Value: String);
    procedure SetExceptionMsg(const Value: String);
    procedure SetSourceClass(const Value: string);
    function GetSourceClass: string;
    function GetExceptionMsg: String;
    { Private declarations }
  public
    property ExceptionClass:String Read GetExceptionClass Write SetExceptionClass;
    property SourceClass:string Read GetSourceClass Write SetSourceClass;
    property ExceptionMsg:String Read GetExceptionMsg Write SetExceptionMsg;
  end;


  procedure myerror(sender: tobject; e: Exception);

implementation

{$R *.dfm}

procedure TFexcept.sbcloseClick(Sender: TObject);
begin
close;
end;

procedure TFexcept.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
end;

procedure TFexcept.FormShow(Sender: TObject);
begin
 MessageBeep(16);
end;

function TFexcept.GetExceptionClass: String;
begin
Result:=errorlx.Text;
end;

function TFexcept.GetExceptionMsg: String;
begin
Result:=errorinfo.Text
end;

function TFexcept.GetSourceClass: string;
begin
Result:=errorobject.Text;
end;

procedure TFexcept.SetExceptionClass(const Value: String);
begin
errorlx.Text:=Value;
end;

procedure TFexcept.SetExceptionMsg(const Value: String);
begin
errorinfo.Text:=Value;
end;

procedure TFexcept.SetSourceClass(const Value: string);
begin
errorobject.Text:=Value;;
end;
procedure myerror(sender: tobject; e: Exception);
var
frm_Exception: TFexcept;
begin
frm_Exception:=TFexcept.Create(nil);
  try
    frm_Exception.ExceptionClass:=E.ClassName;
    if Sender.InheritsFrom(TComponent) then
      frm_Exception.SourceClass:=TComponent(Sender).Name;
    frm_Exception.ExceptionMsg:=E.Message;
    frm_Exception.ShowModal;
  finally
    frm_Exception.Free;
  end;

end;
end.
